/*******************************************************************************
*  file    : deferredresult.hpp
*  created : 29.06.2013
*  author  : 
*******************************************************************************/

#ifndef DEFERREDRESULT_HPP
#define DEFERREDRESULT_HPP

#include <QObject>
#include <QPointer>
#include <traindata.hpp>

class QComboBox;

class UzDataGetter;

class DeferredResult : public QObject
{
    Q_OBJECT
public:
    explicit DeferredResult(QObject *parent = 0);
    
    void setCombo(QComboBox* cmb) {combo_ = cmb;}
    QComboBox* combo() const {return combo_;}
    void setRequest (const QString& rk) {request_ = rk;}
    const QString& request() const {return request_;}
    
public slots:
    void onCitiesLoaded(const QString&);
signals:
    void citiesLoaded();
private:
    QComboBox* combo_;
    QString    request_;
};

class TrainDataDeferredResult : public QObject
{
    Q_OBJECT
public:
    explicit TrainDataDeferredResult(UzDataGetter* g = 0, int td_id = -1 ,QObject *parent = 0);
    const    QVector<TrainData>& result() const {return m_result;}
public slots:
    void onTrainDataReady(int);
signals:
    void trainDataReady();
private:
    int                    m_trainDataId;
    QPointer<UzDataGetter> m_getter;

    QVector<TrainData>     m_result;
};

#endif // DEFERREDRESULT_HPP
